﻿using Newtonsoft.Json;
using System;

namespace EventBus.Events
{
    /// <summary>
    /// 集成事件
    /// </summary>
    public class IntegrationEvent
    {
        /// <summary>
        /// 事件ID
        /// </summary>
        [JsonProperty]
        public Guid Id { get; set; }

        /// <summary>
        /// 事件日期
        /// </summary>
        [JsonProperty]
        public DateTime CreationTime { get; set; }

        public IntegrationEvent()
        {
            Id = Guid.NewGuid();
            CreationTime = DateTime.UtcNow;
        }

        /// <summary>
        /// json反序列化使用
        /// </summary>
        /// <param name="id"></param>
        /// <param name="creationTime"></param>
        [JsonConstructor]
        public IntegrationEvent(Guid id,DateTime creationTime)
        {
            Id = id;
            CreationTime = creationTime;
        }
    }
}
